{extend name='admin@main'}

{block name="button"}
{if auth("store/firmware/add")}
<button data-open='{:url("add")}' data-title="添加固件OTA" class='layui-btn layui-btn-sm layui-btn-primary'>添加固件OTA</button>
{/if}
{if auth("store/firmware/remove")}
<button data-action='{:url("remove")}' data-rule="id#{key}" class='layui-btn layui-btn-sm layui-btn-primary'>删除固件OTA</button>
{/if}
{/block}

{block name="content"}

<div class="think-box-shadow">
    {include file='firmware/index_search'}
    <table class="layui-table margin-top-10" lay-skin="line">
        {notempty name='list'}
        <thead>
        <tr>
            <th class='list-table-check-td think-checkbox'>
                <input data-auto-none data-check-target='.list-check-box' type='checkbox'>
            </th>
            <th class='text-left nowrap'>ID</th>
            <th class='text-left nowrap'>车型名称</th>
            <th class='text-left nowrap'>OTA部位</th>
            <th class='text-left nowrap'>版本号</th>
            <th class='text-left nowrap'>固件包</th>
            <th class='text-left nowrap'>上传时间</th>
            <th class='text-left nowrap'>是否开放下载</th>
            <th class='text-left nowrap'>操作</th>

            <th></th>
        </tr>
        </thead>
        {/notempty}
        <tbody>
        {foreach $list as $key=>$vo}
        <tr data-dbclick>
            <td class='list-table-check-td think-checkbox'><input class="list-check-box" value='{$vo.id}' type='checkbox'></td>
            <td class='text-left nowrap'>
                <div class="inline-block">
                    {$vo.id|default=''}
                </div>
            </td>

            <td class='text-left nowrap'>
                <div class="inline-block">
                    {$vo.name|default=''}
                </div>
            </td>
            <td class='text-left nowrap'>
                <div class="inline-block">
                    {$vo.part_name|default=''}
                </div>
            </td>

            <td class='text-left nowrap'>
                <div class="inline-block">
                    {$vo.firmware_sn|default=''}
                </div>
            </td>

            <td class='text-left nowrap'>
                <div class="inline-block">
                    {$vo.link|default=''}
                </div>
            </td>

            <td class='text-left nowrap'>
                <div class="inline-block">
                    {$vo.create_at|default=''}
                </div>
            </td>

            <td class='text-left nowrap'>
                <div class="inline-block">
                    {$vo.is_open1|default=''}
                </div>
            </td>

            <td class='text-left nowrap'>

                <div class="nowrap margin-bottom-5">
                    <a data-dbclick class="layui-btn layui-btn-sm" data-open='{:url("edit")}?id={$vo.id}'>编 辑</a>
                    <a class="layui-btn layui-btn-sm layui-btn-danger" data-confirm="确定要删除数据吗?" data-action="{:url('remove')}" data-value="id#{$vo.id}">删 除</a>
                    {if isset($vo.is_open) and $vo.is_open eq 1}
                    <a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('forbid')}" data-value="id#{$vo.id};is_open#0">取消开放</a>
                    {else}
                    <a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('resume')}" data-value="id#{$vo.id};is_open#1">开放</a>
                    {/if}
                </div>

            </td>
        </tr>
        {/foreach}
        </tbody>
    </table>

    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}

</div>
{/block}
